import request from '@/utils/request'
import type { LoginForm, loginResponseData, userResponseData } from './type'

enum API {
  LOGIN_URL = '/user/login',
  USERINFO_URL = '/user/info',
}

// login
export const reqLogin = (data: LoginForm) => {
  return request<any, loginResponseData>({
    url: API.LOGIN_URL,
    method: 'post',
    data,
  })
}

// userinfo
export const reqUserInfo = () =>
  request<any, userResponseData>({
    url: API.USERINFO_URL,
    method: 'get',
  })
